
# CMake 最低版本号要求
cmake_minimum_required (VERSION 2.8)
# 项目信息
project (unionsys_core_zhou)

find_package(catkin REQUIRED COMPONENTS
  geometry_msgs
  mavros
  roscpp
)
# 指定生成目标
#add_executable(Demo main.cc)
include_directories(${catkin_INCLUDE_DIRS} include)

add_library(unionsys_core SHARED src/unionsys_core.cpp)
target_include_directories( unionsys_core 
    PUBLIC
        "${CMAKE_CURRENT_SOURCE_DIR}/include"
)
target_link_libraries(unionsys_core
  ${catkin_LIBRARIES}
)

# 指定deb包的版本号
set(_VERSION_MAJOR 1)
set(_VERSION_MINOR 1)
set(_VERSION_PATCH 0)
set(CPACK_PACKAGE_VERSION_MAJOR "${_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${_VERSION_PATCH}")
# 指定CPack生成的是deb包（还可以是其他包如 <.7z> <.zip> 等）
set(CPACK_GENERATOR "DEB")
# 指定包名
set(CPACK_PACKAGE_NAME "unionsys_core")
# 指定程序名，就是程序安装后的名字
set(CPACK_DEBIAN_PACKAGE_NAME "unionsys_core")

# 指定所需的依赖
# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgrpc++")
# 设置包作者的联系方式
set(CPACK_PACKAGE_CONTACT "759562862@qq.com")
# 指定需要安装的文件
set(head_files  include/unionsys_core.hpp)
INSTALL(FILES  ${head_files} 
        DESTINATION  /usr/local/include)
INSTALL(TARGETS unionsys_core
        RUNTIME DESTINATION /usr/lib
        LIBRARY DESTINATION /usr/lib    # 通常，编译器只会在 </usr/lib> 和 </lib> 中找头文件，如果
        ARCHIVE DESTINATION /usr/lib    # 将库文件放在其他目录，可能会引起找不到库文件错误
        )


include(CPack)
